

initializeColumns = function() {

new MUI.Column({
id: 'sideColumn1',
placement: 'left',
width: 90,
resizeLimit: [90, 300]
});

new MUI.Column({
id: 'mainColumn',
placement: 'main',
resizeLimit: [90, 300]
});


// Add panels to main column
new MUI.Panel({
id: 'leftPanel1',
addClass: 'mochaConsole',
title: 'FastLink1',
contentURL: 'Single/Tpl/default/Public/leftIconLink.html',
column: 'sideColumn1',
height: 200
});


new MUI.Panel({
id: 'leftPanel2',
addClass: 'mochaConsole',
title: 'FastLink2',
contentURL: 'Single/Tpl/default/Public/leftIconLink2.html',
column: 'sideColumn1',
height: 0
});

new MUI.Panel({
id: 'mainPanel',
addClass: 'mochaConsole',
title: 'Console',
contentURL: 'index.php/Index/main',
column: 'mainColumn',
height: 200,
headerToolbox: true,
headerToolboxURL: 'Single/Tpl/default/Public/toolbox.html',
headerToolboxOnload: function(){
$$('.demoAction').each(function(element){
element.removeEvents();
element.addEvent('click', function(e){
MUI.notification('To be done:)');
});
});
}
});
//add event
if($('licenseLink')){
	updateMain('GPL license ',$('licenseLink').href,'licenseLink');
}

if($('getSn')){
	$('getSn').addEvent('click',function() { 
	var vlu = parseInt(Cookie.read('HAS_SN'));
	switch(vlu)
	{
	case 1:	updateMain('Serial number','index.php/Admin/entSn');//已申请，未验证输入
	break;
	case 2:	updateMain('Serial number','index.php/Admin/showSn?sn='+Cookie.read('__SN'));//已申请，验证输入成功
	break;
	case 3:	msg(vlu);
	break;	
	case 4: {if(Cookie.read('HAS_SN')==1){updateMain('Serial number','index.php/Admin/entSn');}//未申请或刚申请成功未刷新单Cookie已经修改
			 else {
				 if(Cookie.read('HAS_SN')==2)
				 {updateMain('Serial number','index.php/Admin/showSn?sn='+Cookie.read('__SN'));}
				 else{updateMain('Serial number','index.php/Admin/getSn');}
				 }
			}
	break;
	default: updateMain('Serial number','index.php/Admin/getSn');;
	}
});

//定时执行
var CHKSN = function(){ 
var snnum =Cookie.read('__SN');
var macx = Cookie.read('__MAC');
 if($chk(snnum) && (snnum !='') && (snnum.length>30)  )
{
	//var urlstr = 'http://yuanbao.org/Y/index.php/Admin/chkSN';
	var urlstr = 'http://localhost/Dev/Y/index.php/Admin/chkSN';
	new Request.JSONP({
	url:  urlstr,
    data: {
        sn: snnum,
        mac: macx
    },	
	onComplete: function(data){
				alert('定时检测：'+data['msg']);
				if(data['status']=='ok')
				{	msg('有序列号的免费用户');	}
				else
				{
					msg(data['msg']+' ,请参加淘宝帮派获取您的序列号');
					//$('getSn').click();
					window.location.replace("http://bangpai.taobao.com/group/thread/1029205-13418376.htm");
				}
	}
	}).send();
}
else
{alert('序列号不正确,请到帮派完成任务，获得序列号');window.location.replace("http://bangpai.taobao.com/group/thread/1029205-13418376.htm");}
};
//1000*60*60 reminder reg
CHKSN.periodical(1000*60*300);

}



// Deactivate menu header links
$$('a.returnFalse').each(function(el) {
el.addEvent('click', function(e) {
new Event(e).stop();
});
});

MUI.myChain.callChain();
};//end innit

window.addEvent('load', function(){ 

MUI.myChain = new Chain();
MUI.myChain.chain(
function(){MUI.Desktop.initialize();},
function(){MUI.Dock.initialize();},
function(){initializeColumns();}
).callChain();

});
